package com.winning.pmph.utils;

import com.google.common.collect.Sets;
import com.winning.pmph.entity.KnowledgeLibField;

import java.util.*;

public interface Const {

    String ES_KNOWLEDGE_INDEX = "knowledge";
    String ES_KNOWLEDGE_TYPE = "knowledge";
    String ES_ARTICLE_INDEX = "article";
    String ES_ARTICLE_TYPE = "article";

    List<Integer> ES_KNOWLEDGE_FIELD_TYPE_ARRAY = Collections.unmodifiableList(
            Arrays.asList(KnowledgeLibField.FIELD_KIND_STRINGTEXT,
                KnowledgeLibField.FIELD_KIND_RICHEDITOR,
                KnowledgeLibField.FIELD_KIND_TEXTAREA,
                KnowledgeLibField.FIELD_KIND_MULTI_VALUE_INPUT)
    );
    /**
     * 术语图书级别
     */
    Map<String, String> BOOK_IMG_CLS_2_KNOWLEDGE_IMG_CLS = Collections.unmodifiableMap(new HashMap<String, String>() {{
        put("CT", "rw_img table");
        put("BZ", "rw_img bz");
        put("GS", "rw_img formula");
        put("HNT", "rw_img hnt");
    }});

    float SIMILAR_FACTOR = 0.8f;

    String EXERCISE_SOURCE_DIY = "手动创建";

    int BATCH_SIZE = 100;

    /**
     * 知识字段类型默认值
     */
    List<String> KNOWLEDGE_FIELD_VALUE_DEFAULT = Collections.unmodifiableList(
            Arrays.asList(
            "",     // 输入框      0
            "",     // 富文本      1
            "[]",   // 参照        2
            "",     // 单选下拉框   3
            "{\"paths\": [],\"additional\": \"\",\"comment\": \"\",\"type\": \"\",\"classification\": \"\",\"title\": \"\"}",   //图片
            "[]",   // 多选下拉框    5
            "",     // 文本域        6
            "[]",   // 多值输入框     7
            "[]",   // 关联本知识库    8
            "[]",   // 关联其它本知识库 9
            "[]",   // 关联应用平台    10
            "{\"paths\":[],\"type\":\"\",\"title\":\"\"}",   // 视频
            "[]",   // 文件           12
            ""      // h5
    ));

    /**
     * 图书标记状态
     */
    Integer BOOK_MARKED_STATUS_UNMARKED = 0;
    Integer BOOK_MARKED_STATUS_MARKING = 1;
    Integer BOOK_MARKED_STATUS_DONE = 2;

    /**
     * 知识单元状态
     */
    Integer KNOWLEDGE_UNIT_STATUS_TEMP = 0;
    Integer KNOWLEDGE_UNIT_STATUS_RELEASE = 1;
    Integer KNOWLEDGE_UNIT_STATUS_MATERIAL = 2;

    /**
     * 知识单元内容, 按h标签切割为字段, 不属于任何字段(属于当前知识单元)的内容 key
     */
    String KNOWLEDGE_UNIT_FIELD_SELF = "无标题";
    String KNOWLEDGE_UNIT_CUSTOM_TAG_KEY = "自由标签";

    /**
     * 数组与字符串互转, 分隔符;
     */
    String SPLIT_CHAR = ",";

    boolean isWin = System.getProperty("os.name").toLowerCase().contains("win");

    boolean isLinux = System.getProperty("os.name").toLowerCase().indexOf("linux") >= 0;

    /**
     * 线程池, 默认4个线程
     */
    int FIXED_THREAD_POOL_SIZE = 4;

    /**
     * 药物信息库ID
     */
    String DRUG_INFO_LIB_ID = "0001AA100000000HUKPT";

    /**
     * 药物信息库生产企业ID
     */
    String DRUG_INFO_LIB_COMPANY_ID = "0001AA100000000HUKQ0";
    /**
     * 问答库id
     */
    String QW_LIB_ID = "0001AA100000000WD711";
    /**
     * 药物信息库来源ID
     */
    String DRUG_INFO_LIB_SOURCE_ID = "0001AA100000000RN6HX";

    Set<String> HTML_TAGS = Collections.unmodifiableSet(Sets.newHashSet("p", "div", "img", "sub", "sup", "b", "i", "a", "table", "italic", "title", "label",
            "h1", "h2", "h3", "h4", "h5", "h6", "strong", "em", "center", "ul", "ol", "font", "br", "hr", "del", "file"));

    Map<String, String> JOURNAL_TAG_TRANSFER_MAP = Collections.unmodifiableMap(new HashMap<String, String>() {{
        put("disp-formula", "div");
        put("inline-formula", "span");
        put("inline-fourmula", "span");
        put("table-wrap", "div");
        put("alternatives", "div");
        put("ref-list", "div");
        put("ref", "div");
        put("label", "span");
        put("mixed-citation", "span");
        put("fig", "div");
        put("sec", "div");
        put("app-group", "div");
        put("app", "div");
        put("boxed-text", "div");
    }});

    /**
     * 期刊中的body和back节点里的标签
     */
    Set<String> JOURNAL_TAG = Collections.unmodifiableSet(Sets.newHashSet("tbody", "thead", "fn", "title", "italic", "body",
            "ref-list", "sup", "sub", "sec", "ref", "table-wrap-foot", "graphic", "table", "mixed-citation",
            "xref", "inline-graphic", "label", "disp-formula", "p", "td", "inline-formula", "th", "alternatives",
            "table-wrap", "tr", "bold", "fig", "inline-fourmula", "div", "h1", "fn-group", "app-group", "app",
            "break", "list-item", "list", "ack", "boxed-text", "bz", "response", "front-stub", "title-group",
            "article-title", "subtitle", "img", "strike", "underline"));

    /**
     * 同步类型  新增
     */
    String SYNC_OPERATION_ADD = "add";

    /**
     * 同步类型  新增
     */
    String SYNC_OPERATION_DELETE = "delete";

    /**
     * 图片
     */
    String FILE_TYPE_IMAGE = "image";
    /**
     * 视频
     */
    String FILE_TYPE_VIDEO = "video";
    /**
     * 文件
     */
    String FILE_TYPE_FILE = "file";

    /**
     * 音频
     */
    String FILE_TYPE_AUDIO = "audio";

    Integer NEWEST_YES = 1;
    Integer NEWEST_NO = 0;

    /**
     * 医学计算器结果说明ID
     */
    String MEDICAL_CALC_RESULT_ID = "0001AA100000000AAERB";

    /**
     * 术语来源类型  导入
     */
    Integer IMPORT = 0;

    /**
     * 术语来源类型  编辑自建
     */
    Integer SELF_BUILD = 1;

    /**
     * 手动创建;
     */
    Integer MANUAL_CREATE = 1;

    /**
     * 自动创建;
     */
    Integer AUTOMATIC_CREATE = 2;

    /**
     * 冲突创建;
     */
    Integer CONFLICT_CREATE = 3;

    /**
     * 手动修改;
     */
    Integer MANUAL_UPDATE = 4;

    /**
     * 自动更新;
     */
    Integer AUTOMATIC_UPDATE = 5;

    /**
     * 冲突更新;
     */
    Integer CONFLICT_UPDATE = 6;
    /**
     * 入库术语
     */
    Integer BETWEEN_TERM = 0;
    /**
     * 标准术语冲突
     */
    Integer STANDARD_CONFLICT_TERM = 1;
    /**
     * 通过冲突创建的标准术语,且不是当前术语的历史版本
     */
    Integer STANDARD_CONFLICT_NEW_TERM = 2;

    /**
     * 标准术语
     */
    Integer WITH_SAME_STANDARD_TERM = 3;

    /**
     * 未删除
     */
    Integer DELETED_NO = 0;

    /**
     * 已删除
     */
    Integer DELETED_YES = 1;

    /**
     * 术语图书级别
     */
    Map<Integer, String> TERM_BOOK_CATEGORY = Collections.unmodifiableMap(new HashMap<Integer, String>() {{
        put(0, "名词委员会");
        put(1, "卫健委发布标准");
        put(2, "教材");
        put(3, "专著");
    }});

    /**
     * 术语元数据
     */
    String TERM_METADATA = "term_metadata";

    /**
     * 未同步
     */
    Integer SYNC_NO = 0;

    /**
     * 已同步
     */
    Integer SYNC_YES = 1;

    String JOURNAL_METADATA = "journal_metadata";

    String JOURNAL_CATALOG = "journal_catalog";

    String JOURNAL_ARTICLE_METADATA = "journal_article_metadata";

    String JOURNAL_ARTICLE_CATALOG = "journal_article_catalog";

    String JOURNAL_ARTICLE_CONTENT = "journal_article_content";

    /**
     * 新媒体文章供稿库
     */
    String NEW_MEDIA_LIB_ID = "0001AA100000000X76U6";

    String NEW_MEDIA_LIB_MAIN_BODY_ID = "0001AA100000000X76UB";

    /**
     * 匹配url
     */
    String REGEX_URL = "(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";

    Integer IMPORT_STATUS_IMPORTING = 0;
    Integer IMPORT_STATUS_FAILURE = 1;
    Integer IMPORT_STATUS_SUCCESS = 2;

    /**
     * 静态资源文件类型  单个
     */
    Integer FILE_LIB_TYPE_SINGLE = 1;

    /**
     * 静态资源文件类型  组
     */
    Integer FILE_LIB_TYPE_GROUP = 2;

    /**
     * 图书类型  电子书
     */
    Integer BOOK_TYPE_ELECTRONIC = 0;
    /**
     * 图书类型 电子书+增值
     */
    Integer BOOK_TYPE_ELECTRONIC_AND_INCREASE = 1;
    /**
     * 增值
     */
    Integer BOOK_TYPE_INCREASE = 2;

    /**
     * 图书质检状态  未付型
     */
    Integer BOOK_QUALITY_STATUS_NOT_FUXING = 1;
    /**
     * 图书质检状态  已付型
     */
    Integer BOOK_QUALITY_STATUS_FUXING = 2;

    /**
     * 图书分类信息根节点ID
     */
    String TAG_BOOK_ROOT_ID = "e4d0874b39454005afe298541798bebb";

}
